import bundleManager from '@ohos.bundle.bundleManager'
import { KEY_API_TOKEN } from './KvManager'

export async function isLogin(): Promise<boolean> {

  const token = await this.getKv(KEY_API_TOKEN)
  if (token) {
    return true
  }
  return false
}

export async function getVersionName(): Promise<string> {
  const bundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT)
  const versionName = bundleInfo.versionName
  return versionName
}

export async function getVersionCode(): Promise<number> {
  const bundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT)
  const versionCode = bundleInfo.versionCode
  return versionCode
}

// export function a() {
//    var tus = require("tus-js-client")
// }